//@author A0105735J
// This function enable all members to use log
// singleton pattern is applied
#pragma once
#ifndef LOGGER_H
#define LOGGER_H
#include <string>
#include <fstream>
#include <stddef.h>

class Logger
{
private:	
	std::ofstream file;

public:
	// open the log file
	Logger(void){
		file.open("log.txt");
	}
	// close the log file
	~Logger(void){
		file.close();
	}
	// write log message
	void LogMessage(std::string message){
		file << message << std::endl;
	}
	// get instance of logger
	static Logger * instance(){
		static Logger myinstance;
		return &myinstance;
	}
};
#endif